home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’89 / PopUpCtl / TestControl.r < prev   
Encoding:
Text File  |  1988-07-19  |  2.0 KB  |  91 lines  |  [TEXT/MPS ]

  1. include        "TestControl.code";
  2.  
  3. include        "PopUp.ctrl";
  4.  
  5. /* define the first of two menus.  The definition consists
  6.     of two parts, defining the control, which happens here,
  7.     and defining the menu embodied in the control which
  8.     happens next */
  9. resource 'CNTL' (1024) {
  10.     { 0, 0, 20, 190 },
  11.     2,                            /* initial value/selected item */
  12.     visible,
  13.     1, 100,                        /* min and max values, actually
  14.                                     placeholders since they get
  15.                                     dynamically determined by the
  16.                                     # of items in the menu */
  17.     (PopUpID * 16),                /* high 12 bits are rsrc id of
  18.                                     the CDEF, low 4 bits are
  19.                                     variant:
  20.                                         0 = left justified
  21.                                         1 = centered */
  22.     128,                        /* rsrc id of the menu to put
  23.                                     in the control */
  24.     "Baud Rate: "                /* title of the control.  Displayed
  25.                                     to the left of the popup menu
  26.                                     if not 0 length */
  27. };
  28.  
  29. /* define the menu which goes into the first of the controls */
  30. resource 'MENU' (128) {
  31.     128,
  32.     textMenuProc,
  33.     allEnabled,
  34.     enabled,
  35.     "",
  36.     {
  37.         "300",                    noIcon, noKey, noMark, plain;
  38.         "1200",                    noIcon, noKey, noMark, plain;
  39.         "2400",                    noIcon, noKey, noMark, plain;
  40.         "4800",                    noIcon, noKey, noMark, plain;
  41.         "9600",                    noIcon, noKey, noMark, plain
  42.     }
  43. };
  44.  
  45.  
  46. /* now then define a second popup menu, this one get's 
  47.     centered though */
  48. resource 'CNTL' (1025) {
  49.     { 0, 0, 20, 190 },
  50.     1,
  51.     visible,
  52.     1,
  53.     100,
  54.     (PopUpID * 16) + 1,            /* centered popup menu */
  55.     129,
  56.     ""
  57. };
  58.  
  59. resource 'MENU' (129) {
  60.     129,
  61.     textMenuProc,
  62.     allEnabled,
  63.     enabled,
  64.     "Stop Bits: ",
  65.     {
  66.         "1 Stop Bit",            noIcon, noKey, noMark, plain;
  67.         "1.5 Stop Bits",        noIcon, noKey, noMark, plain;
  68.         "2 Stop Bits",            noIcon, noKey, noMark, plain
  69.     }
  70. };
  71.  
  72. /* define the dialog and it's item list */
  73. resource 'DLOG' (256, "PopUp Menus") {
  74.     { 0, 0, 100, 200 },
  75.     plainDBox,
  76.     invisible,
  77.     noGoAway,
  78.     0,
  79.     256,
  80.     "Popup Menus"
  81. };
  82.  
  83. resource 'DITL' (256) {
  84.     {
  85.     {   5,  75,  25, 125 },    Button        { enabled, "OK" },
  86.     {  30,  70,  50, 130 },    CheckBox    { enabled, "Enabled" },
  87.     {  55,   5,  75, 190 },    Control        { enabled, 1024 },
  88.     {  80,   5, 100, 190 },    Control        { enabled, 1025 }
  89.     }
  90. };
  91.